package demo3;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class Test {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<Integer> queue = new LinkedBlockingQueue<>(3);
        queue.put(1);
        queue.put(2);
        queue.put(3);
        System.out.println("已经放入三个了");
//        queue.put(4);
//        System.out.println("已经放入四个了");
        queue.take();
        queue.take();
        queue.take();
        System.out.println("已经取出三个了");
        queue.take();
        System.out.println("已经取出四个了");


    }
}
